package twitorg;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import twinb.Twinb;

public class LoginServiceServlet extends HttpServlet
{
    public static final String DEFAULT_VIEW = "today";

    public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException
    {
        String uname = req.getParameter("username");
        String pwd = req.getParameter("password");
        String view = req.getParameter("view");
        if (view == null)
            view = DEFAULT_VIEW;
        
        Twinb tw = Twinb.get(uname);
        tw.setUser(uname, pwd);
        
        req.getSession().setAttribute("username", uname);
    }
}
